import React from 'react';
import {
View,
Text,
StyleSheet,
ScrollView,
useColorScheme,
ActivityIndicator,
} from 'react-native';
import { useLocalSearchParams, Stack } from 'expo-router';
import { Colors } from '../../constants/Colors';
import { useTask } from '../../hooks/useTasks';
import { TaskStatusBadge } from '../../components/TaskStatusBadge';
import { EmptyState } from '../../components/EmptyState';
export default function TaskDetailScreen() {
const colorScheme = useColorScheme() ?? 'light';
const colors = Colors[colorScheme];
const { id } = useLocalSearchParams<{ id: string }>();
const { data: task, isLoading, isError } = useTask(id);
if (isLoading) {
return (
<>
>
);
}
if (isError || !task) {
return (
<>
>
);
}
return (
<>
{/* Header */}
{task.name}
{task.description && (
{task.description}
)}
{/* Progress Summary */}
{task.progressSummary && (
Progress
{task.progressSummary}
)}
{/* Task Info */}
Details
Created
{new Date(task.createdAt).toLocaleString()}
{task.startedAt && (
Started
{new Date(task.startedAt).toLocaleString()}
)}
{task.completedAt && (
Completed
{new Date(task.completedAt).toLocaleString()}
)}
{task.repositoryUrl && (
Repository
{task.repositoryUrl}
)}
{/* Subtasks */}
{task.subtasks && task.subtasks.length > 0 && (
Subtasks ({task.subtasks.length})
{task.subtasks.map((subtask) => (
{subtask.name}
))}
)}
{/* Error message */}
{task.errorMessage && (
Error
{task.errorMessage}
)}
{/* Placeholder for future features */}
Task output and controls will be added here
>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
centered: {
justifyContent: 'center',
alignItems: 'center',
},
content: {
padding: 16,
gap: 16,
},
header: {
padding: 16,
borderRadius: 12,
gap: 8,
},
headerTop: {
flexDirection: 'row',
justifyContent: 'flex-start',
},
taskName: {
fontSize: 20,
fontWeight: '700',
},
description: {
fontSize: 14,
lineHeight: 20,
},
section: {
padding: 16,
borderRadius: 12,
gap: 12,
},
sectionTitle: {
fontSize: 16,
fontWeight: '600',
},
progressText: {
fontSize: 14,
lineHeight: 20,
},
infoRow: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
infoLabel: {
fontSize: 14,
},
infoValue: {
fontSize: 14,
fontWeight: '500',
flex: 1,
textAlign: 'right',
marginLeft: 16,
},
subtaskRow: {
flexDirection: 'row',
alignItems: 'center',
gap: 8,
paddingVertical: 4,
},
subtaskName: {
fontSize: 14,
flex: 1,
},
errorSection: {
backgroundColor: '#fee2e2',
},
errorText: {
fontSize: 14,
color: '#991b1b',
lineHeight: 20,
},
placeholder: {
padding: 32,
alignItems: 'center',
},
placeholderText: {
fontSize: 14,
textAlign: 'center',
},
});